package cn.com.seederland.gkrpc.client;

import cn.com.seederland.gkrpc.Peer;
import cn.com.seederland.gkrpc.codec.Decoder;
import cn.com.seederland.gkrpc.codec.Encoder;
import cn.com.seederland.gkrpc.codec.JSONDecoder;
import cn.com.seederland.gkrpc.codec.JSONEncoder;
import cn.com.seeederland.gkrpc.transport.HTTPTransportClient;
import cn.com.seeederland.gkrpc.transport.TransportClient;

import java.util.Arrays;
import java.util.List;

public class RpcClientConfig {
    /**
     * 使用哪个网络模块的实现
     */
    private Class<? extends TransportClient> transportClass = HTTPTransportClient.class;
    /**
     * 序列化
     */
    private Class<? extends Encoder> encoderClass = JSONEncoder.class;
    /**
     * 反序列化
     */
    private Class<? extends Decoder> decoderClass = JSONDecoder.class;
    /**
     * 连接选择路由器
     */
    private Class<? extends TransportSelector> transportSelectorClass = RandomTransportSelector.class;
    /**
     * 默认连接数
     */
    private int connectCount = 1;
    /**
     * 可供使用的服务器列表
     */
    private List<Peer> servers = Arrays.asList(new Peer("127.0.0.1", 3000));

    public Class<? extends TransportClient> getTransportClass() {
        return transportClass;
    }

    public void setTransportClass(Class<? extends TransportClient> transportClass) {
        this.transportClass = transportClass;
    }

    public Class<? extends Encoder> getEncoderClass() {
        return encoderClass;
    }

    public void setEncoderClass(Class<? extends Encoder> encoderClass) {
        this.encoderClass = encoderClass;
    }

    public Class<? extends Decoder> getDecoderClass() {
        return decoderClass;
    }

    public void setDecoderClass(Class<? extends Decoder> decoderClass) {
        this.decoderClass = decoderClass;
    }

    public Class<? extends TransportSelector> getTransportSelectorClass() {
        return transportSelectorClass;
    }

    public void setTransportSelectorClass(Class<? extends TransportSelector> transportSelectorClass) {
        this.transportSelectorClass = transportSelectorClass;
    }

    public int getConnectCount() {
        return connectCount;
    }

    public void setConnectCount(int connectCount) {
        this.connectCount = connectCount;
    }

    public List<Peer> getServers() {
        return servers;
    }

    public void setServers(List<Peer> servers) {
        this.servers = servers;
    }
}
